package com.bigShen.pattern.rules.bDependenceInversion.demo;

/**
 * @Author eddy.shen
 * @Date 2020/2/25 21:51
 **/
public class Mother {

      // v2
//    public void readContent(IReader reader) {
//
//        System.out.println("开始阅读");
//        System.out.println(reader.getContent());
//
//    }

      // v3
//    IReader reader;
//
//    public Mother(IReader reader) {
//        this.reader = reader;
//    }

    // v4
    IReader reader;
    public void setReader(IReader reader) {
        this.reader = reader;
    }

    public void readContent() {
        System.out.println("开始阅读");
        System.out.println(reader.getContent());
    }
}
